#!/bin/bash
# 更新软件包索引
sudo apt-get update -y

# 安装依赖包
sudo apt-get install ca-certificates curl -y
sleep 3
# 创建目录存放密钥
sudo install -m 0755 -d /etc/apt/keyrings

# 下载 Docker 的官方 GPG 密钥
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
sleep 3
# 添加 Docker APT 仓库
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sleep 3
# 更新软件包索引（包含新添加的 Docker 仓库）
sudo apt-get update -y
sleep 3
# 安装 Docker Engine
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin -y
sleep 3
sudo ln -s /usr/libexec/docker/cli-plugins/docker-compose /usr/local/bin/docker-compose -y
sleep 3

sudo apt-get update -y
sudo apt-get install -y ca-certificates curl gnupg -y 

sudo install -m 0755 -d /etc/apt/keyrings
sleep 3
curl -fsSL https://apt.minepi.com/repository.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/pinetwork-archive-keyring.gpg
sleep 3
sudo chmod a+r /etc/apt/keyrings/pinetwork-archive-keyring.gpg
sleep 3
echo 'deb [arch=amd64 signed-by=/etc/apt/keyrings/pinetwork-archive-keyring.gpg] https://apt.minepi.com stable main' | sudo tee /etc/apt/sources.list.d/pinetwork.list > /dev/null
sleep 3
sudo apt-get update -y
sleep 3
sudo apt-get install -y pi-node 
sleep 3
docker pull pinetwork/pi-node-docker:organization_mainnet-v1.2-p19.6
